-
Notifications
You must be signed in to change notification settings - Fork 117
chore(l1): review peer handler and misc logs #5150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view |
| "Sync Log 5: Requesting block headers from peer {peer_id}, chunk_limit: {chunk_limit}" | ||
| %peer_id, | ||
| %chunk_limit, | ||
| "request_block_headers: Requesting block headers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the message a bit redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
| "We had an error dumping the last accounts to disk {}", | ||
| err.error | ||
| error=%err.error, | ||
| "We had an error dumping the last accounts to disk", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "We had an error dumping the last accounts to disk", | |
| "Failed to dump the last accounts to disk", |
| .expect("Shouldn't have a join error") | ||
| .inspect_err(|err| { | ||
| error!("We found this error while dumping to file {err:?}") | ||
| error!(error=?err.error, "We found this error while dumping to file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| error!(error=?err.error, "We found this error while dumping to file") | |
| error!(error=?err.error, "Error dumping to file") |
| result | ||
| .inspect_err(|err| error!("We found this error while dumping to file {err:?}")) | ||
| result.inspect_err( | ||
| |err| error!(error=?err.error, "We found this error while dumping to file"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| |err| error!(error=?err.error, "We found this error while dumping to file"), | |
| |err| error!(error=?err.error, "Error dumping to file"), |
| }); | ||
| connection.outgoing_message(txs_message).await.unwrap_or_else(|err| { | ||
| error!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions"); | ||
| debug!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to have this on error: If it fails the broadcaster is broken and user should be aware.
| ); | ||
| connection.outgoing_message(hashes_message.clone()).await.unwrap_or_else(|err| { | ||
| error!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions hashes"); | ||
| debug!(peer_id = %format!("{:#x}", peer_id), err = ?err, "Failed to send transactions hashes"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
|
|
||
| let _ = self.broadcast_txs().await.inspect_err(|_| { | ||
| error!("Failed to broadcast transactions"); | ||
| debug!("Failed to broadcast transactions"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it LGTM.
Left some minor comments and suggestions
| let sync_head_number_retrieval_start = SystemTime::now(); | ||
|
|
||
| info!("Retrieving sync head block number from peers"); | ||
| debug!("Retrieving sync head block number from peers"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe having one log when the requesting start isn't bad, but I'll check if there aren't anothers.
| .unwrap_or_default(); | ||
|
|
||
| info!("Sync head block number retrieved"); | ||
| debug!("Sync head block number retrieved"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace?
| "[SYNCING] Received empty/invalid headers from peer, penalizing peer {peer_id}" | ||
| debug!( | ||
| %peer_id, | ||
| "[SYNCING] Received empty/invalid headers from peer, penalizing peer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the [SYNCING], or in general every [FOO]
| chunk_limit: u64, | ||
| ) -> Result<Vec<BlockHeader>, PeerHandlerError> { | ||
| debug!("Requesting block headers from peer {peer_id}"); | ||
| debug!(%peer_id, "Requesting block headers from peer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace
| state_root: H256, | ||
| tx: tokio::sync::mpsc::Sender<(Vec<AccountRangeUnit>, H256, Option<(H256, H256)>)>, | ||
| ) -> Result<(), PeerHandlerError> { | ||
| debug!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace
| remaining_start: chunk_start, | ||
| remaining_end: chunk_end, | ||
| }; | ||
| debug!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace
| task_count += 1; | ||
| } | ||
| debug!("Split big storage account into {chunk_count} chunks."); | ||
| debug!(chunk_count, "Split big storage account into chunks."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably trace? Or is this exceptional?
Motivation
We are in the process of downgrading logs that are useless to the user to debug and moving the format to structured logging from tracing.
Description
Progress for #4950